package com.dianjing.dianjing.controller;

import com.dianjing.dianjing.dto.input.TestInput;
import com.dianjing.dianjing.service.TestService;
import com.dianjing.dianjing.util.DataUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @Author liangbaigao
 * @Date 2022/11/7 14:06
 */
@Data
@RequestMapping("/test")
@Api(tags = "测试接口文档")
@RestController
public class TestSwaggerController {

    @Resource
    private TestService testService;

    @ApiOperation("测试接口文档")
    @GetMapping("/getMsg")
    private DataUtils getMsg(){
        return DataUtils.ok("测试成功");
    }

    @ApiOperation("测试拿接口数据")
    @GetMapping("/getDta")
    private DataUtils getDta(){
        return testService.getDta();
    }


    @ApiOperation("测试插入接口数据")
    @PostMapping("/insertData")
    private DataUtils insertData(@RequestBody @Valid TestInput input){
        return testService.insertData(input);
    }

    
}
